package com.ytt.core.service.mapper;

import org.mapstruct.InheritConfiguration;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.MappingTarget;

import java.util.Collection;
import java.util.List;

public interface BasicMapper<T, D, E>{
    @InheritConfiguration
    D toDTO(T entity);

    @InheritConfiguration(name = "toDTO")
    List<D> toDTO(Collection<T> entities);

    @InheritInverseConfiguration(name = "toDTO")
    T toEntity(D dto);

    @InheritConfiguration(name = "toEntity")
    List<T> toEntity(Collection<D> dtos);

    @InheritConfiguration(name = "toEntity")
    void updateEntity(E dto, @MappingTarget T entity);
}
